/*
 * @Author: your name
 * @Date: 2020-03-30 23:17:58
 * @LastEditTime: 2020-03-31 19:21:13
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \普联东文-未完成\js\hover.js
 */

(function ($) {
  $.fn.num6 = function () {
    n1 = $(this).width();
    h1 = $(this).height();

    var becurr = "background:#2e64ae;position:absolute;"
    // top边框
    var divTop = "<div style='" + becurr + "top:-2px;left:" + n1 / 2 + "px;width:0;height:2px'></div>";

    // right边框
    var divRight = "<div style='" + becurr + "top:" + h1 / 2 + "px;right:-2px;width:2px;height:0;'></div>";

    // Bottom边框
    var divBottom = "<div style='" + becurr + "bottom:-2px;right:" + n1 / 2 + "px;width:0;height:2px'></div>";

    // Left边框
    var divLeft = "<div style='" + becurr + "bottom:" + h1 / 2 + "px;left:-2px;width:2px;height:0;'></div>";

    $(this).append(divTop, divRight, divBottom, divLeft);
    $(this).hover(function () {
      console.log(`99999999`);

      $(this).find("div:nth-child(odd)").stop().animate({
        width: n1 + 3.5,
        left: -2
      }, 300);
      $(this).find("div:nth-child(even)").stop().animate({
        height: h1 + 3.5,
        top: -2
      }, 300);
    }, function () {
      $(this).find("div:nth-child(odd)").stop().animate({
        width: 0,
        left: n1 / 2
      }, 300);
      $(this).find("div:nth-child(even)").stop().animate({
        height: 0,
        top: h1 / 2
      }, 300);
    })
  }
})(jQuery);

